package com.eu.ebpm.engine.express.validator;

import com.eu.ebpm.engine.express.Variable;

/**
 * 
 * @author wangxiaohua
 *
 */
public class StringTypeValidator implements TypeValidator<String> {

	public String transform(Object value) {
		return (String) value;
	}

	public boolean checkVariable(Variable<String> variable, Object condition) {
		if(condition instanceof String) {
			if(variable.getExpress().equals("=") || variable.getExpress().equals("==")) {
				return variable.getValue().equals(condition);
			} else {
				return !variable.getValue().equals(condition);
			}
		}
		return false;
	}

}
